/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * com_distri_compras_proveedores.java
 *
 * Created on 31/08/2011, 01:15:42 PM
 */

package sie_invdis;


import java.sql.*;
import javax.swing.*;
import java.awt.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Calendar;

import java.text.ParseException;
import java.text.*;
/**
 *
 * @author Michelle
 */
public class com_distri_compras_proveedores extends javax.swing.JFrame {

     private javax.swing.table.DefaultTableModel jtable_modelo_proveedor;

    bd_conexion x = new bd_conexion();
    ResultSet rs = null;


    int fempleadoactual=0, fpreguntaactual=0,fpuestoactual=0,findicadoractual,opcioncatalogo=2,controlcomboasi=0;
    private SimpleDateFormat formateador = new SimpleDateFormat("dd-MM-yyyy");
    private SimpleDateFormat formateadoresta = new SimpleDateFormat("yyyy-MM-dd");
    String textobuscaemplea="";
    /** Creates new form com_distri_compras_proveedores */
    public com_distri_compras_proveedores() {
        this.iniciar_modelo_proveedor();
        initComponents();
        this.carga_datos_proveedor(0,"");

        jt_proveedores.getColumnModel().getColumn(0).setPreferredWidth(50);//cuenta
        jt_proveedores.getColumnModel().getColumn(1).setPreferredWidth(50);//status
        jt_proveedores.getColumnModel().getColumn(2).setPreferredWidth(60);//clasif
        jt_proveedores.getColumnModel().getColumn(3).setPreferredWidth(120);//provee
        jt_proveedores.getColumnModel().getColumn(4).setPreferredWidth(80);//direccion
        jt_proveedores.getColumnModel().getColumn(5).setPreferredWidth(80);//poblacion
        jt_proveedores.getColumnModel().getColumn(6).setPreferredWidth(60);//telefono
        jt_proveedores.getColumnModel().getColumn(7).setPreferredWidth(60);//ultima compra
        jt_proveedores.getColumnModel().getColumn(8).setPreferredWidth(20);//ini articulo
        jt_proveedores.getColumnModel().getColumn(9).setPreferredWidth(20);//subfam
        jt_proveedores.getColumnModel().getColumn(10).setPreferredWidth(60);//acum compra
        jt_proveedores.getColumnModel().getColumn(11).setPreferredWidth(60);//observ
        this.buttonGroup1.setSelected(jrb_bdescrip.getModel(), true);

        this.jtf_busqueda.requestFocus();

    }
private void iniciar_modelo_proveedor()
    {
        jtable_modelo_proveedor=new javax.swing.table.DefaultTableModel();//Creo el modelo
        jtable_modelo_proveedor.addColumn("<html><b>Cuenta</b></html>");
        jtable_modelo_proveedor.addColumn("<html><b>Status</b></html>");
        jtable_modelo_proveedor.addColumn("<html><b>Clasif.</b></html>");
        jtable_modelo_proveedor.addColumn("<html><b>Proveedor</b></html>");
        jtable_modelo_proveedor.addColumn("<html><b>Direccion</b></html>");
        jtable_modelo_proveedor.addColumn("<html><b>Poblacion</b></html>");
        jtable_modelo_proveedor.addColumn("<html><b>Telefono</b></html>");
        jtable_modelo_proveedor.addColumn("<html><b>Ult.Compra</b></html>");
        jtable_modelo_proveedor.addColumn("<html><b>Ini.Art.</b></html>");
        jtable_modelo_proveedor.addColumn("<html><b>Subfam</b></html>");
        jtable_modelo_proveedor.addColumn("<html><b>Acum.Compra</b></html>");
        jtable_modelo_proveedor.addColumn("<html><b>Observ.</b></html>");
    }
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel2 = new javax.swing.JPanel();
        jtf_busqueda = new javax.swing.JTextField();
        jbtn_buscar = new javax.swing.JButton();
        jrb_direccion = new javax.swing.JRadioButton();
        jrb_bdescrip = new javax.swing.JRadioButton();
        jrb_bclave = new javax.swing.JRadioButton();
        jLabel2 = new javax.swing.JLabel();
        jrb_idsubfam = new javax.swing.JRadioButton();
        jrb_clasificacion = new javax.swing.JRadioButton();
        jrb_ctacontrol = new javax.swing.JRadioButton();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jt_proveedores = new javax.swing.JTable()
        {
            public boolean isCellEditable(int rowIndex, int mColIndex) {
                return false;
            }
        }
        ;
        jLabel4 = new javax.swing.JLabel();
        jlbl_textobuscado = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jlbl_cantidadregistros = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jbtn_add_art = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jmni_salir = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jmni_escape = new javax.swing.JMenuItem();
        jmni_actualizar = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(sie_invdis.Sie_invdisApp.class).getContext().getResourceMap(com_distri_compras_proveedores.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel2.border.title"))); // NOI18N
        jPanel2.setName("jPanel2"); // NOI18N

        jtf_busqueda.setToolTipText(resourceMap.getString("jtf_busqueda.toolTipText")); // NOI18N
        jtf_busqueda.setName("jtf_busqueda"); // NOI18N
        jtf_busqueda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtf_busquedaActionPerformed(evt);
            }
        });

        jbtn_buscar.setIcon(resourceMap.getIcon("jbtn_buscar.icon")); // NOI18N
        jbtn_buscar.setText(resourceMap.getString("jbtn_buscar.text")); // NOI18N
        jbtn_buscar.setName("jbtn_buscar"); // NOI18N
        jbtn_buscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_buscarActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrb_direccion);
        jrb_direccion.setText(resourceMap.getString("jrb_direccion.text")); // NOI18N
        jrb_direccion.setToolTipText(resourceMap.getString("jrb_direccion.toolTipText")); // NOI18N
        jrb_direccion.setActionCommand(resourceMap.getString("jrb_direccion.actionCommand")); // NOI18N
        jrb_direccion.setName("jrb_direccion"); // NOI18N
        jrb_direccion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrb_direccionActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrb_bdescrip);
        jrb_bdescrip.setText(resourceMap.getString("jrb_bdescrip.text")); // NOI18N
        jrb_bdescrip.setToolTipText(resourceMap.getString("jrb_bdescrip.toolTipText")); // NOI18N
        jrb_bdescrip.setActionCommand(resourceMap.getString("jrb_bdescrip.actionCommand")); // NOI18N
        jrb_bdescrip.setName("jrb_bdescrip"); // NOI18N
        jrb_bdescrip.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrb_bdescripActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrb_bclave);
        jrb_bclave.setText(resourceMap.getString("jrb_bclave.text")); // NOI18N
        jrb_bclave.setToolTipText(resourceMap.getString("jrb_bclave.toolTipText")); // NOI18N
        jrb_bclave.setActionCommand(resourceMap.getString("jrb_bclave.actionCommand")); // NOI18N
        jrb_bclave.setName("jrb_bclave"); // NOI18N
        jrb_bclave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrb_bclaveActionPerformed(evt);
            }
        });

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        buttonGroup1.add(jrb_idsubfam);
        jrb_idsubfam.setText(resourceMap.getString("jrb_idsubfam.text")); // NOI18N
        jrb_idsubfam.setActionCommand(resourceMap.getString("jrb_idsubfam.actionCommand")); // NOI18N
        jrb_idsubfam.setName("jrb_idsubfam"); // NOI18N
        jrb_idsubfam.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrb_idsubfamActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrb_clasificacion);
        jrb_clasificacion.setText(resourceMap.getString("jrb_clasificacion.text")); // NOI18N
        jrb_clasificacion.setActionCommand(resourceMap.getString("jrb_clasificacion.actionCommand")); // NOI18N
        jrb_clasificacion.setName("jrb_clasificacion"); // NOI18N
        jrb_clasificacion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrb_clasificacionActionPerformed(evt);
            }
        });

        buttonGroup1.add(jrb_ctacontrol);
        jrb_ctacontrol.setText(resourceMap.getString("jrb_ctacontrol.text")); // NOI18N
        jrb_ctacontrol.setActionCommand(resourceMap.getString("jrb_ctacontrol.actionCommand")); // NOI18N
        jrb_ctacontrol.setName("jrb_ctacontrol"); // NOI18N
        jrb_ctacontrol.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jrb_ctacontrolActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(304, 304, 304)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jbtn_buscar))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(239, 239, 239)
                        .addComponent(jrb_bclave)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrb_bdescrip)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrb_direccion)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrb_idsubfam)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jrb_clasificacion)
                        .addGap(2, 2, 2)
                        .addComponent(jrb_ctacontrol)))
                .addContainerGap(240, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jtf_busqueda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtn_buscar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jrb_bclave)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jrb_bdescrip, javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jrb_direccion)
                            .addComponent(jrb_idsubfam)
                            .addComponent(jrb_clasificacion)
                            .addComponent(jrb_ctacontrol))))
                .addGap(5, 5, 5))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jPanel3.border.title"))); // NOI18N
        jPanel3.setName("jPanel3"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jt_proveedores.setModel(this.jtable_modelo_proveedor);
        jt_proveedores.setName("jt_proveedores"); // NOI18N
        jt_proveedores.setRowHeight(22);
        jt_proveedores.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jt_proveedoresMouseClicked(evt);
                if(evt.getClickCount() >= 2)
                {
                    dioclick(evt);
                    //System.out.println(" double click" );

                }
            }
        });
        jScrollPane1.setViewportView(jt_proveedores);

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jlbl_textobuscado.setFont(resourceMap.getFont("jlbl_textobuscado.font")); // NOI18N
        jlbl_textobuscado.setName("jlbl_textobuscado"); // NOI18N

        jLabel3.setFont(resourceMap.getFont("jLabel3.font")); // NOI18N
        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jlbl_cantidadregistros.setFont(resourceMap.getFont("jlbl_cantidadregistros.font")); // NOI18N
        jlbl_cantidadregistros.setText(resourceMap.getString("jlbl_cantidadregistros.text")); // NOI18N
        jlbl_cantidadregistros.setName("jlbl_cantidadregistros"); // NOI18N

        jLabel5.setFont(resourceMap.getFont("jLabel5.font")); // NOI18N
        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jlbl_textobuscado, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addGap(18, 18, 18)
                .addComponent(jlbl_cantidadregistros, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel5)
                .addContainerGap())
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 983, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jlbl_cantidadregistros)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(jlbl_textobuscado))
                .addGap(9, 9, 9)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 405, Short.MAX_VALUE))
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        jPanel4.setName("jPanel4"); // NOI18N

        jbtn_add_art.setIcon(resourceMap.getIcon("jbtn_add_art.icon")); // NOI18N
        jbtn_add_art.setText(resourceMap.getString("jbtn_add_art.text")); // NOI18N
        jbtn_add_art.setName("jbtn_add_art"); // NOI18N
        jbtn_add_art.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtn_add_artActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jbtn_add_art, javax.swing.GroupLayout.PREFERRED_SIZE, 159, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(838, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jbtn_add_art)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jMenuBar1.setName("jMenuBar1"); // NOI18N

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jmni_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        jmni_salir.setIcon(resourceMap.getIcon("jmni_salir.icon")); // NOI18N
        jmni_salir.setText(resourceMap.getString("jmni_salir.text")); // NOI18N
        jmni_salir.setName("jmni_salir"); // NOI18N
        jmni_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_salirActionPerformed(evt);
            }
        });
        jMenu1.add(jmni_salir);

        jMenuBar1.add(jMenu1);

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N

        jmni_escape.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0));
        jmni_escape.setText(resourceMap.getString("jmni_escape.text")); // NOI18N
        jmni_escape.setName("jmni_escape"); // NOI18N
        jmni_escape.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_escapeActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_escape);

        jmni_actualizar.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
        jmni_actualizar.setText(resourceMap.getString("jmni_actualizar.text")); // NOI18N
        jmni_actualizar.setName("jmni_actualizar"); // NOI18N
        jmni_actualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jmni_actualizarActionPerformed(evt);
            }
        });
        jMenu2.add(jmni_actualizar);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(27, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jtf_busquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtf_busquedaActionPerformed
        // TODO add your handling code here:
        this.jbtn_buscarActionPerformed(evt);
}//GEN-LAST:event_jtf_busquedaActionPerformed

    private void jbtn_buscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_buscarActionPerformed
        // TODO add your handling code here:
        // this.jtf_busqueda.getText();
        if(JOptionPane.showConfirmDialog(null, "Estan Correctos sus Datos?")==0) {
            this.carga_datos_proveedor(opcioncatalogo, this.jtf_busqueda.getText().trim().toUpperCase());
        } else {
            this.jtf_busqueda.requestFocus();
        }

    }//GEN-LAST:event_jbtn_buscarActionPerformed

    private void jrb_direccionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_direccionActionPerformed
        // TODO add your handling code here:
        opcioncatalogo=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_direccionActionPerformed

    private void jrb_bdescripActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bdescripActionPerformed
        // TODO add your handling code here:
        opcioncatalogo=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bdescripActionPerformed

    private void jrb_bclaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_bclaveActionPerformed
        // TODO add your handling code here:
        opcioncatalogo=Integer.parseInt(evt.getActionCommand().toString());
}//GEN-LAST:event_jrb_bclaveActionPerformed

    private void jmni_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_salirActionPerformed
        // TODO add your handling code here:
        if(JOptionPane.showConfirmDialog(null, "Desea Salir?")==0)
              {
            this.dispose();
        }
        
    }//GEN-LAST:event_jmni_salirActionPerformed

    private void jmni_escapeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_escapeActionPerformed
        // TODO add your handling code here:
        this.jmni_salirActionPerformed(evt);
    }//GEN-LAST:event_jmni_escapeActionPerformed

    private void jrb_idsubfamActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_idsubfamActionPerformed
        // TODO add your handling code here:
          opcioncatalogo=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jrb_idsubfamActionPerformed

    private void jrb_clasificacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_clasificacionActionPerformed
        // TODO add your handling code here:
    opcioncatalogo=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jrb_clasificacionActionPerformed

    private void jrb_ctacontrolActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jrb_ctacontrolActionPerformed
        // TODO add your handling code here:
    opcioncatalogo=Integer.parseInt(evt.getActionCommand().toString());
    }//GEN-LAST:event_jrb_ctacontrolActionPerformed

    private void jbtn_add_artActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtn_add_artActionPerformed
        // TODO add your handling code here:
        JFrame mainFrame = Sie_invdisApp.getApplication().getMainFrame();
        com_distri_compras_proveedores_alta fcdcpe=new com_distri_compras_proveedores_alta(mainFrame,true);
        fcdcpe.setVisible(true);
}//GEN-LAST:event_jbtn_add_artActionPerformed

    private void jmni_actualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jmni_actualizarActionPerformed
        // TODO add your handling code here:
        this.carga_datos_proveedor(0, "");
}//GEN-LAST:event_jmni_actualizarActionPerformed
private void carga_datos_proveedor(int opcion,String textobusca)
    {
       //invoco al metodo que trae el recordset de datos
       //voy por el detalle del documento
       while(jtable_modelo_proveedor.getRowCount()>0)jtable_modelo_proveedor.removeRow(0);
       Object[] fnewRow = new Object[12];

       try
       {
            rs = x.sieuno_executediversosv2("select * from x1distribucion_terminados_proveedores("+opcion+",'"+textobusca+"') as (idpro character varying(12),descripcion character varying(60),direccion character varying(50),colonia character varying(50),poblacion character varying(40),cp character varying(6),rfc character varying(15),curp character varying(20),telefono character varying(30),fax character varying(15),email character varying(50),clasificacion character varying(10),diascredito smallint,limitecredito numeric,descproveedor numeric,fecultventa date,fecultpago date,inicialprovee character varying(20),observa character varying(80),inicialesfinal character varying(3),ctacontrol smallint,subfam smallint,idstatus smallint,acumuladocom numeric,bitacora text,descripclasif character varying(40),obserclasif character varying(30),descripcuenta text,obsercuenta text,describestatus text);",variables_global.getconexiongral());
            while (rs.next())
                {
                        fnewRow[0]=rs.getString("descripcuenta");
                        fnewRow[1]=rs.getString("idstatus")+":"+rs.getString("describestatus");
                        fnewRow[2]=rs.getString("clasificacion")+":"+rs.getString("descripclasif");
                        fnewRow[3]=rs.getString("idpro")+":"+rs.getString("descripcion");
                        fnewRow[4]=rs.getString("direccion")+" "+rs.getString("colonia");
                        fnewRow[5]=rs.getString("poblacion");
                        fnewRow[6]=rs.getString("telefono")+" "+rs.getString("email");
                        fnewRow[7]=rs.getString("fecultventa");
                        fnewRow[8]=rs.getString("inicialesfinal");
                        fnewRow[9]=rs.getString("subfam");
                        fnewRow[10]=rs.getString("acumuladocom");
                        fnewRow[11]=rs.getString("observa");
                        jtable_modelo_proveedor.addRow(fnewRow);
                }
        }
        catch(Exception e)
            {
            System.out.println(e.getMessage());
            }

     this.jlbl_cantidadregistros.setText(String.valueOf(this.jtable_modelo_proveedor.getRowCount()));
     this.jlbl_textobuscado.setText(this.jtf_busqueda.getText().toUpperCase().trim());
   }
 
private void jt_proveedoresMouseClicked(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
    }
private void dioclick(java.awt.event.MouseEvent evt) {
        // TODO add your handling code here:
         System.out.println("dio doble  click");
         int fila = jt_proveedores.getSelectedRow();
         String valor[] = jt_proveedores.getValueAt(fila, 3).toString().split(":");
        com_distri_compras_proveedores_edita fcdcpe=new com_distri_compras_proveedores_edita(valor[0]);
        fcdcpe.pack();
        fcdcpe.setVisible(true);
        //setVisible(false);
    }

 
    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new com_distri_compras_proveedores().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton jbtn_add_art;
    private javax.swing.JButton jbtn_buscar;
    private javax.swing.JLabel jlbl_cantidadregistros;
    private javax.swing.JLabel jlbl_textobuscado;
    private javax.swing.JMenuItem jmni_actualizar;
    private javax.swing.JMenuItem jmni_escape;
    private javax.swing.JMenuItem jmni_salir;
    private javax.swing.JRadioButton jrb_bclave;
    private javax.swing.JRadioButton jrb_bdescrip;
    private javax.swing.JRadioButton jrb_clasificacion;
    private javax.swing.JRadioButton jrb_ctacontrol;
    private javax.swing.JRadioButton jrb_direccion;
    private javax.swing.JRadioButton jrb_idsubfam;
    private javax.swing.JTable jt_proveedores;
    private javax.swing.JTextField jtf_busqueda;
    // End of variables declaration//GEN-END:variables

}
